<!DOCTYPE html>
<html
  layout:decorator="components/layout"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  xmlns:th="http://www.thymeleaf.org"
  lang="zh-CN"
>
<head>
  <meta
    http-equiv="Content-Type"
    content="text/html; charset=utf-8"
  />
  <title>编辑管理员组</title>
  <style>
    /**
   下拉列表
    */
    .realm, .user {
      width: 230px;
      height: 400px;
    }
  </style>
</head>
<body>
<div
  layout:fragment="content"
  class="container"
  id="app" v-cloak
>
  <div class="container">
    <div class="myHeader">
      <div class="myHeader-title">
        管理组修改
      </div>
      <div class="myHeader-tool">
        <el-button
          size="mini"
          @click="addGroup"
          type="primary"
          v-realm="'system-configuration:sys-user:edit'"
        >新增组
        </el-button>
        <el-button
          size="mini"
          type="danger"
          @click="deleteGroup"
          v-realm="'system-configuration:sys-user:edit'"
        >删除组
        </el-button>
      </div>
    </div>

    <div class="myTabs">
      <el-tabs v-model="activeName" type="border-card">
        <el-tab-pane label="基本" name="mode1">
          <div class="myHeader">
            <div class="myHeader-title">
              系统管理员
            </div>
          </div>

          <table
            width="100%"
            border="0"
            class="el-table el-table--border"
            cellspacing="0"
            cellpadding="0"
          >
            <tbody>
            <tr>
              <td
                width="100"

              ><b>名称</b></td>
              <td>
                <el-input
                  v-model="form.name"
                  name="name"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td><b>状态</b></td>
              <td>
                <input
                  v-show="form.status === 1"
                  type="image"
                  src="/static/img/icon_open.gif"
                  title="点击关闭"
                  @click="updateSysRoleStatus({status: 2})"
                >
                <input
                  v-show="form.status !== 1"
                  type="image"
                  src="/static/img/icon_close.gif"
                  title="点击开启"
                  @click="updateSysRoleStatus({status: 1})"
                >
                （如果组被暂停，相关用户仍能登录，不过将失去对应的权限）
              </td>
            </tr>
            <tr>
              <td><b>创建日期</b></td>
              <td>{{dateFormat(form.createTime)}}</td>
            </tr>
            <tr>
              <td><b>描述</b></td>
              <td>
                <el-input
                  v-model="form.description"
                  name="description"
                ></el-input>
              </td>
            </tr>
            </tbody>
          </table>
          <div align="center">
            <el-button
              type="primary"
              @click="updateSysRole"
              v-realm="'system-configuration:sys-user:edit'"
            >保存
            </el-button>
            <el-button
              @click="_forward('/system-config/admin_privilege')"
            >返回
            </el-button>
          </div>
        </el-tab-pane>

        <el-tab-pane label="权限" name="mode2">
          <div class="myHeader">
            <div class="myHeader-title">
              系统管理员的权限
            </div>
          </div>
          <table
            cellspacing="4"
            width="100%"
            height="100%"
            class="el-table el-table--border"
            cellpadding="2"
          >
            <tbody>
            <tr>
              <td>
                <table
                  cellpadding="0"
                  cellspacing="2"
                  class="el-table el-table--border"
                  border="0"
                >
                  <!-- groupprivilege_list/ -->
                  <tbody>
                  <tr>
                    <td><b>组权限</b></td>
                    <td>
                      <table
                        cellpadding="0"
                        cellspacing="0"
                        class="el-table el-table--border"
                        border="0"
                      >
                        <tbody>
                        <tr>
                          <td></td>
                          <td><b>可添加权限</b></td>
                          <td></td>
                          <td><b>已拥有权限</b></td>
                        </tr>
                        <tr>
                          <td></td>
                          <td>
                            <select
                              v-model="notIncludeSysMenuSelectList"
                              multiple=""
                              class="realm"
                            >
                              <option
                                v-for="sysMenu in form.notIncludeSysMenuList"
                                :value="sysMenu"
                              >{{sysMenu.label}}
                              </option>
                            </select>
                          </td>
                          <td align="left">
                            &nbsp;
                            <el-row>
                              <el-button
                                type="primary"
                                size="mini"
                                @click="addSysMenuList"
                              >添加 >>
                              </el-button>
                            </el-row>
                            <el-row>
                              <el-button
                                @click="deleteSysMenuList"
                                type="danger"
                                size="mini"
                              >删除 <<
                              </el-button>
                            </el-row>

                          </td>
                          <td>
                            <input
                              type="hidden"
                              name="groupprivileges"
                              value=""
                            >
                            <select
                              v-model="includeSysMenuSelectList"
                              multiple=""
                              name="groupprivileges_select"
                              class="realm"
                            >
                              <option
                                v-for="sysMenu in form.includeSysMenuList"
                                :value="sysMenu"
                              >{{sysMenu.label}}
                              </option>
                            </select>
                          </td>
                        </tr>
                        <tr>
                          <td
                            colspan="4"
                            align="center"
                          >
                            （按住Ctrl键，可用鼠标同时选择多个组）
                          </td>
                        </tr>
                        </tbody>
                      </table>
                    </td>
                  </tr>
                  <!-- /groupprivilege_list -->
                  </tbody>
                </table>
              </td>
            </tr>
            </tbody>
          </table>
          <div align="center">
            <el-button
              @click="updateSysMenu"
              type="primary"
              v-realm="'system-configuration:sys-user:edit'"
            >保存权限
            </el-button>
            &nbsp;
            <el-button
              @click="_forward('system-config/admin_privilege')"
            >返回
            </el-button>
          </div>
        </el-tab-pane>

        <el-tab-pane label="组成员" name="mode3">
          <div class="myHeader">
            <div class="myHeader-title">
              组成员
            </div>
          </div>
          <table
            cellpadding="0"
            cellspacing="2"
            class="el-table el-table--border"
            border="0"
          >
            <!-- logingroup_list/ -->
            <tbody>
            <tr>
              <td><b>成员列表</b></td>
              <td>
                <table
                  cellpadding="0"
                  cellspacing="0"
                  class="el-table el-table--border"
                  border="0"
                >
                  <tbody>
                  <tr>
                    <td></td>
                    <td><b>非成员</b></td>
                    <td></td>
                    <td><b>包含成员</b></td>
                  </tr>
                  <tr>
                    <td></td>
                    <td>
                      <select
                        v-model="notIncludeSysUserSelectList"
                        multiple
                        name="leftlogin_select"
                        class="user"
                      >
                        <option
                          v-for="sysUser in this.form.notIncludeSysUserList"
                          :value="sysUser"
                        >{{sysUser.loginName}}
                        </option>
                      </select>
                    </td>
                    <td align="left">
                      <el-row>
                        <el-button
                          type="primary"
                          size="mini"
                          @click="addSysUserList"
                        >添加 >>
                        </el-button>
                      </el-row>
                      <el-row>
                        <el-button
                          type="danger"
                          size="mini"
                          @click="deleteSysUserList"
                        >删除 <<
                        </el-button>
                      </el-row>

                    </td>
                    <td>
                      <input
                        type="hidden"
                        name="grouplogins"
                        value=""
                      >
                      <select
                        v-model="includeSysUserSelectList"
                        multiple=""
                        name="grouplogins_select"
                        class="user"
                      >
                        <option
                          v-for="sysUser in form.includeSysUserList"
                          :value="sysUser"
                        >{{sysUser.loginName}}
                        </option>
                      </select>
                    </td>
                  </tr>
                  <tr>
                    <td
                      colspan="4"
                      align="center"
                    >
                      （按住Ctrl键，可用鼠标同时选择多个用户）
                    </td>
                  </tr>
                  </tbody>
                </table>
              </td>
            </tr>
            </tbody>
          </table>
          <div align="center">
            <el-button
              @click="updateSysUser"
              v-realm="'system-configuration:sys-user:edit'"
            >保存成员
            </el-button>&nbsp;
            <el-button
              @click="_forward('system-config/admin_privilege');"
            >返回
            </el-button>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</div>
</body>

<div layout:fragment="js">
  <script src="/static/js/module/system-config/model/SysRole.js"></script>
  <script src="/static/js/module/system-config/api/sysRoleApi.js"></script>
  <script src="/static/js/module/system-config/common/admin_privilege_group_validate.js"></script>
  <script src="/static/js/module/system-config/modify/admin_privilege_group_edit.js"></script>
</div>
</html>
